import java.util.*;

public class task5 {

	public static void main(String[] args) {
		
		int size , i , d=0;

		Scanner sc= new Scanner(System.in);

		do{
		System.out.print("Enter the array size: ");
		size = sc.nextInt();

		if(size<1)
		System.out.println("Error: invalid input");
		}while(size<1);

		double[] a = new double[size];

		System.out.print("Enter element at index# 1 of the array: ");
		a[0]=sc.nextDouble();

		for(i=1 ; i<a.length ; i++)
		{
			System.out.printf("Enter element at index# %d of the array: ",i+1);
			a[i]=sc.nextDouble();
			if(a[i]<a[i-1])
			d = 1;
		}
		
		if(d==1)
			System.out.print("\n\nThe array is not sorted in non-decreasing order");
		else
			System.out.print("\n\nThe array is sorted in non-decreasing order");

		sc.close();
			
	}

}
